package com.example.backend.service;

import com.example.backend.entity.Response;
import com.example.backend.mapper.ResponseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ResponseService {
    private ResponseMapper responseMapper;

    @Autowired
    public ResponseService(ResponseMapper responseMapper){this.responseMapper = responseMapper;}

    public boolean addResponses(@Param("responseId") int id,@Param("postId") int id2, @Param("userId") int id3,@Param("content") String content){
        int responses = responseMapper.addResponses(id,id2,id3,content);
        if(responses == 0)
            return false;
        else
            return true;
    }
    public boolean deleteResponses(@Param("responseId") int id){
        int responseId = responseMapper.deleteResponses(id);
        if (responseId == 0)
            return false;
        else
            return true;
    }
}
